package main

import "fmt"

// 深层嵌套结构体定义
type Address struct {
	Street  string
	City    string
	Country string
	ZipCode string
}

type ContactInfo struct {
	Phone   string
	Email   string
	Address Address
}

type Company struct {
	Name        string
	Industry    string
	Employees   int
	ContactInfo ContactInfo
}

type Project struct {
	Name        string
	Description string
	Budget      float64
	Status      string
}

type Department struct {
	Name     string
	Manager  string
	Projects []Project
	Budget   float64
}

type Employee struct {
	ID          int
	Name        string
	Age         int
	Salary      float64
	ContactInfo ContactInfo
	Company     Company
	Department  Department
}

type Team struct {
	Name     string
	Leader   Employee
	Members  []Employee
	Budget   float64
	Projects []Project
	IsActive bool
}

type Organization struct {
	Name        string
	CEO         Employee
	Teams       []Team
	Departments []Department
	TotalBudget float64
	YearFounded int
}

// 深层嵌套数据结构（7层以上）
type Level7 struct {
	Value string
	Data  map[string]interface{}
}

type Level6 struct {
	ID    int
	Next  *Level7
	Items []string
}

type Level5 struct {
	Name string
	Next *Level6
	Tags []string
}

type Level4 struct {
	Code  string
	Next  *Level5
	Count int
}

type Level3 struct {
	Index int
	Next  *Level4
	Flags []bool
}

type Level2 struct {
	Label  string
	Next   *Level3
	Values []int
}

type Level1 struct {
	Title    string
	Next     *Level2
	Children []Level2
}

func main() {
	// 创建深层嵌套组织结构
	org := Organization{
		Name:        "TechCorp International",
		YearFounded: 2010,
		TotalBudget: 50000000.0,
		CEO: Employee{
			ID:     1,
			Name:   "Alice Johnson",
			Age:    45,
			Salary: 250000.0,
			ContactInfo: ContactInfo{
				Phone: "+1-555-0001",
				Email: "alice@techcorp.com",
				Address: Address{
					Street:  "123 Executive Ave",
					City:    "San Francisco",
					Country: "USA",
					ZipCode: "94102",
				},
			},
			Company: Company{
				Name:      "TechCorp HQ",
				Industry:  "Technology",
				Employees: 5000,
				ContactInfo: ContactInfo{
					Phone: "+1-555-9999",
					Email: "info@techcorp.com",
					Address: Address{
						Street:  "456 Corporate Blvd",
						City:    "San Francisco",
						Country: "USA",
						ZipCode: "94103",
					},
				},
			},
		},
		Teams: []Team{
			{
				Name:     "Engineering",
				IsActive: true,
				Budget:   5000000.0,
				Leader: Employee{
					ID:     10,
					Name:   "Bob Smith",
					Age:    38,
					Salary: 180000.0,
					ContactInfo: ContactInfo{
						Phone: "+1-555-0010",
						Email: "bob@techcorp.com",
						Address: Address{
							Street:  "789 Tech Street",
							City:    "San Francisco",
							Country: "USA",
							ZipCode: "94104",
						},
					},
				},
				Members: []Employee{
					{
						ID:     101,
						Name:   "Charlie Davis",
						Age:    30,
						Salary: 120000.0,
					},
					{
						ID:     102,
						Name:   "Diana Prince",
						Age:    28,
						Salary: 115000.0,
					},
					{
						ID:     103,
						Name:   "Ethan Hunt",
						Age:    32,
						Salary: 125000.0,
					},
				},
				Projects: []Project{
					{
						Name:        "Cloud Platform",
						Description: "Next-gen cloud infrastructure",
						Budget:      2000000.0,
						Status:      "In Progress",
					},
					{
						Name:        "AI Assistant",
						Description: "Enterprise AI chatbot",
						Budget:      1500000.0,
						Status:      "Planning",
					},
				},
			},
			{
				Name:     "Product",
				IsActive: true,
				Budget:   3000000.0,
				Leader: Employee{
					ID:     20,
					Name:   "Eva Martinez",
					Age:    35,
					Salary: 165000.0,
				},
				Members: []Employee{
					{
						ID:     201,
						Name:   "Frank Miller",
						Age:    29,
						Salary: 110000.0,
					},
					{
						ID:     202,
						Name:   "Grace Lee",
						Age:    31,
						Salary: 118000.0,
					},
				},
				Projects: []Project{
					{
						Name:        "Mobile App 2.0",
						Description: "Redesigned mobile experience",
						Budget:      1200000.0,
						Status:      "In Progress",
					},
				},
			},
		},
		Departments: []Department{
			{
				Name:    "Research & Development",
				Manager: "Dr. Henry Wu",
				Budget:  8000000.0,
				Projects: []Project{
					{
						Name:        "Quantum Computing",
						Description: "Quantum algorithm research",
						Budget:      5000000.0,
						Status:      "Research",
					},
				},
			},
		},
	}

	// 创建极深层级的嵌套结构（测试深度限制）
	deepNested := Level1{
		Title: "Root Level",
		Next: &Level2{
			Label:  "Second Level",
			Values: []int{1, 2, 3, 4, 5},
			Next: &Level3{
				Index: 300,
				Flags: []bool{true, false, true},
				Next: &Level4{
					Code:  "L4-CODE",
					Count: 4444,
					Next: &Level5{
						Name: "Level 5 Node",
						Tags: []string{"tag1", "tag2", "tag3"},
						Next: &Level6{
							ID:    60000,
							Items: []string{"item1", "item2", "item3", "item4"},
							Next: &Level7{
								Value: "Deepest Level Reached!",
								Data: map[string]interface{}{
									"key1": "value1",
									"key2": 123,
									"key3": true,
									"nested": map[string]string{
										"innerKey": "innerValue",
									},
								},
							},
						},
					},
				},
			},
		},
		Children: []Level2{
			{
				Label:  "Child 1",
				Values: []int{10, 20, 30},
			},
			{
				Label:  "Child 2",
				Values: []int{40, 50, 60},
			},
		},
	}

	// 创建大数组测试
	largeArray := make([]int, 100)
	for i := 0; i < 100; i++ {
		largeArray[i] = i * i
	}

	// 创建复杂的 map 结构
	complexMap := map[string]interface{}{
		"organization": org,
		"stats": map[string]int{
			"totalEmployees": 150,
			"totalProjects":  25,
			"activeTeams":    2,
		},
		"metadata": map[string]string{
			"version":   "1.0.0",
			"timestamp": "2025-01-01",
		},
		"arrays": map[string][]int{
			"fibonacci": {1, 1, 2, 3, 5, 8, 13, 21, 34, 55},
			"primes":    {2, 3, 5, 7, 11, 13, 17, 19, 23, 29},
		},
	}

	// 在此处设置断点 - 测试求值表达式和 Watch
	fmt.Println("=== 深层嵌套对象测试 ===")

	// 测试不同深度的访问
	fmt.Printf("CEO: %s\n", org.CEO.Name)
	fmt.Printf("CEO Address: %s, %s\n", org.CEO.ContactInfo.Address.City, org.CEO.ContactInfo.Address.Country)
	fmt.Printf("Team Leader: %s\n", org.Teams[0].Leader.Name)
	fmt.Printf("First Team Member: %s\n", org.Teams[0].Members[0].Name)
	fmt.Printf("Project Status: %s\n", org.Teams[0].Projects[0].Status)

	fmt.Println("\n=== 极深层级结构测试 ===")
	fmt.Printf("Deep Nested Value: %s\n", deepNested.Next.Next.Next.Next.Next.Next.Value)

	fmt.Println("\n=== 数组测试 ===")
	fmt.Printf("Large Array Length: %d\n", len(largeArray))
	fmt.Printf("Large Array [50]: %d\n", largeArray[50])

	fmt.Println("\n=== 复杂 Map 测试 ===")
	fmt.Printf("Complex Map Keys: %v\n", complexMap)

	// 在此处设置第二个断点 - 测试变量修改
	fmt.Println("\n=== 测试变量修改 ===")
	fmt.Println("可以尝试修改以下变量:")
	fmt.Println("- org.CEO.Age")
	fmt.Println("- org.Teams[0].Budget")
	fmt.Println("- deepNested.Next.Next.Index")
	fmt.Println("- largeArray[0]")

	fmt.Println("\n程序结束")
}
